#pragma once
#include <nlohmann/json.hpp>
#include <entt/entt.hpp>

#include <USRefl/USRefl_99.h>


#include <enoki/array.h>
#include "../Awesome/Texture.h"
#include "../Awesome/MeshAsset.h"
namespace Component
{
	struct Parent
	{
		entt::entity value  = (entt::entity)-1;// invalid id
	};
    
	struct Child
	{
		std::set<entt::entity> value;
	};
	struct Name
	{
		std::string value;
	};
	struct TRS
	{
		Float3 position = {0,0,0};
		Float3 rotation = {0,0,0};
		Float3 scale = { 1,1,1 };

	};

	struct Mesh
	{
		std::shared_ptr<YXX_AS::MeshAsset> mesh;
	};

	struct Material
	{
		//Float3 albedo;
		std::shared_ptr<YXX_AS::Texture2D> albedo;
		float roughness = 1.0f;
	};


};
USRefl_Struct_Non_Intrusive(Component::Parent, value);
USRefl_Struct_Non_Intrusive(Component::Child, value);
USRefl_Struct_Non_Intrusive(Component::Name, value);
USRefl_Struct_Non_Intrusive(Component::TRS, position, rotation, scale);
USRefl_Struct_Non_Intrusive(Component::Mesh, mesh);
USRefl_Struct_Non_Intrusive(Component::Material, albedo, roughness);
// using RegisterComponentFunc = void(*)(MM::EntityEditor<entt::entity>&, ImGuiContext* imCtx);
// 
// 
// #define REGISTER_COMPONENT(Type) \
// extern "C"  __declspec(dllexport) void RegisterComponent(MM::EntityEditor<entt::entity>& editor, ImGuiContext* imCtx){ \
//   ImGui::SetCurrentContext(imCtx);\
//   editor.registerComponent<Component::Type>(#Type);\
// }
